package com.wc.codeforces.排序.Kevin_and_Numbers;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/5/5 11:25
 * @description
 * https://codeforces.com/contest/2061/problem/D
 */
public class Main {
    /**
     * 思路：
     * 小数就合并, 思路不太对
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010;
    static PriorityQueue<Long> q = new PriorityQueue<>();
    static int[] b = new int[N];
    static int n, m;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            m = sc.nextInt();
            for (int i = 1; i <= n; i++) {
                long x = sc.nextInt();
                q.add(x);
            }
            for (int i = 1; i <= m; i++) b[i] = sc.nextInt();
            Arrays.sort(b, 1, m + 1);
            boolean res = true;
            int id = 1;
            while (!q.isEmpty()) {
                long x = q.poll();
                // 数直接相同了
                if (b[id] == x) {
                    id++;
                    continue;
                }
                if (!q.isEmpty()) {
                    long y = q.poll();
                    if (y - x <= 1) q.add(x + y);
                    else break;
                } else {
                    res = false;
                    break;
                }
            }
            if (id != m + 1 || !q.isEmpty()) res = false;
            out.println(res ? "YES" : "NO");
            q.clear();
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

